altp2m: Allow shared entries to be copied to altp2m views during lazycopy
authorTamas K Lengyel <tamas.lengyel@zentific.com>
Wed, 27 Jul 2016 09:31:59 +0000 (10:31 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Wed, 27 Jul 2016 09:31:59 +0000 (10:31 +0100)
commit653948018a6f2e7c4fe314329a9886c6b8388f96
treeec7ff369cb921234c3a979c0886c63956b312a41
parenta97bedb2120eb5b277eb5a9cca85f4e659c17cbe
altp2m: Allow shared entries to be copied to altp2m views during lazycopy

Move sharing locks above altp2m to avoid locking order violation and crashing
the hypervisor during unsharing operations when altp2m is active.

Applying mem_access settings or remapping gfns in altp2m views will
automatically unshare the page if it was shared previously. Also,
disallow nominating pages for which there are pre-existing altp2m
mem_access settings or remappings present. However, allow altp2m to
populate altp2m views with shared entries during lazycopy as unsharing
will automatically propagate the change to these entries in altp2m
views as well.

While we're here, switch to using the appropriate wrappers rather than
calling p2m->get_entry() directly.

Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
xen/arch/x86/mm/mem_sharing.c
xen/arch/x86/mm/mm-locks.h
xen/arch/x86/mm/p2m.c